package XML;

/**
 *
 * @author AlinT
 */
public class ToFileVisitor extends XMLVisitor{
	public static int spaceCount=0;
	public static XMLPrinter printer=new XMLPrinter();

        /**
         * Scrie arborele in fisier
         * @param t nodul ce va fi scris
         */
	public void visit(TagXML t) {

      		printer.write("<"+t.name);
		printer.write(">");
		printer.write("\n");
		spaceCount+=2;
		for(int i=0;i<t.getTaguri().size();i++)
			visit(t.getTaguri().get(i));
		spaceCount-=2;
		printer.write("</"+t.name+">");
		printer.write("\n");
					
	}
}
